package base.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;

public class BsBtnTag extends BsBaseTag {

	private static final long serialVersionUID = 1L;
	
	private String img = "";
	private String color = "info";
	private String onclick = "";

	@Override
	public int doStartTag() throws JspException {
		
		return Tag.EVAL_PAGE;
	}
	
	@Override
	public int doEndTag() throws JspException {
		
		StringBuffer tag = new StringBuffer();
		String fevent = "";
		if(onclick.compareTo("") != 0)
			fevent += " onclick=" + onclick + " ";
		tag.append("<button type=\"button\"  id=\"" + name + "\" class=\"btn btn-" + color + "\"" + fevent +">" + caption);
		if (img.compareTo("") != 0)
			tag.append("<span class='glyphicon glyphicon-" + img + "' aria-hidden='true'></span>");
		tag.append("</button>");
		output(tag);
		return Tag.EVAL_PAGE;
	}

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getOnclick() {
		return onclick;
	}

	public void setOnclick(String onclick) {
		this.onclick = onclick;
	}
	
}
